# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         demo0733
# Description:  可变参数  元组的形式呈现
# Author:       $赵怡蕾
# Date:         2019/3/6
#-------------------------------------------------------------------------------

# def hello(*name):          # 函数名name前面有*就是可变参数
#     sum = 0
#     for item in name:
#         print(item)
#         sum += item
#     return sum
#
# if __name__ == '__main__':
#     ret = hello(1,2,3,4)
#     print(ret)



def hello(type,*name):
    sum = 0
    if type == '*':
        sum = 1
    for item in name:
        if type == '+':
            sum += item
        elif type =='*':
            sum *= item

    return sum

if __name__ == '__main__':
    ret = hello('+',1,2,3,4,5,6,7)
    print(ret)

    ret = hello('*', 1, 2, 3, 4)
    print(ret)